package main

import (
	"fmt"
	"oceanlearn/lib/rabbitMQ"
	"strconv"
	"time"
)

func main() {
	pub := rabbitMQ.NewRabbitMQRouting(rabbitMQ.MQURL, "order345")
	//argsQue := make(map[string]interface{})
	////添加死信队列交换器属性
	//argsQue["x-dead-letter-exchange"] = "dlx_exchange"
	////指定死信队列的路由key，不指定使用队列路由键
	////argsQue["x-dead-letter-routing-key"] = "zhe_mess"
	////添加过期时间
	//argsQue["x-message-ttl"] = 6000 //单位毫秒
	//pub.QueueArg = argsQue
	for i := 0; i < 50; i++ {
		routeKey := ""
		if i%3 == 0 {
			routeKey = "red"
		} else {
			routeKey = "blue"
		}
		pub.PublishRouting(routeKey, time.Now().Format("2006-01-02 15:04:05")+"----"+strconv.Itoa(i))
		fmt.Println(i, routeKey)
	}
	//simple := lib.NewRabbitMQSimple("order1234")

	//for i := 0; i < 50; i++ {
	//	simple.PublishSimple(time.Now().Format("2006-01-02 15:04:05") + "----" + strconv.Itoa(i))
	//	fmt.Println(i)
	//}
	defer pub.Destory()
}
